PHPLIB-1597 Accept a $-prefixed string anywhere an expression is accepted#1571
PHPLIB-1597 Accept a $-prefixed string anywhere an expression is accepted#1571GromNaN merged 3 commits intomongodb:v1.xfrom
Conversation
generator/config/expressions.php
Outdated
| foreach ($bsonTypes as $name => $acceptedTypes) { | ||
| // an expression can be a string with a $-prefixed field name | ||
| if (! in_array('string', $acceptedTypes)) { | ||
| $acceptedTypes[] = 'string'; |
There was a problem hiding this comment.
Assuming this is the only code change in this PR, what about this change allows $-prefixed strings specifically? It looks like you're just accepting any kind of string whenever an expression is expected.
Side note: I couldn't confirm if this was really the only code change in the PR because GitHub's PR view is not correctly labeling all generated files. In the future it'd be preferable to segregate changes to generated files into their own commit.
There was a problem hiding this comment.
I added validation of $string, but that's something the server would do.
Failed to optimize pipeline :: caused by :: $abs only supports numeric types, not string
bbe5e26 to
9f5a3fb
Compare
|
I had to change the order of conditions to please psalm. https://psalm.dev/r/4e4cd7b846 |
b7c1dc6 to
8dc642c
Compare
048454e to
663418d
Compare
Fix PHPLIB-1597
The string representation of a field path is simpler than using the
FieldPathfactory.Before:
After: